package first.niuke.huawei.mediumDifficulty;

/**
 * @ClassName HJ6
 * @description:
 * @author: 荣燊
 * @create: 2021-07-15 14:40
 **/
public class HJ6 {
    // 质数因子,开方，sqrt()方法

    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNext()) {
//            long n = scanner.nextLong();
//
//            long start = System.currentTimeMillis();
//            // 时间的限制，如何优化
//            while (n != 1) {
//                for (int i=2; i<=n; i++) {
//                    if (n % i == 0) {
//                        System.out.print(i+" ");
//                        n /= i;
//                        break;
//                    }
//                }
//            }
//            long end = System.currentTimeMillis();
//            System.out.println("计算时间："+(end-start));
//            // 时间9秒多
//
//        }

        long n = 2000000014;
        long j = (long)Math.sqrt(n);

        for (int i=2; i<= j; i++) {
            while (n % i == 0) {
                System.out.print(i+" ");
                n /= i;
            }
        }

        if (n != 1) {
            System.out.println(n+" ");
        }
    }
}
